package com.myadapter;

import java.util.ArrayList;

import com.example.lizhiinformation.R;

import android.app.Notification;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CommentAdapter extends BaseAdapter {
	private ArrayList<String> list;
	private Context context;
	private LayoutInflater inflater;

	public CommentAdapter(ArrayList<String> content, Context context) {
		super();
		this.list=new ArrayList<String>();
		this.context = context;
		inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}
	public void add(ArrayList<String> list){
		this.list.addAll(list);
		notifyDataSetChanged();
		
	}
	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(0);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder=null;
		if(convertView==null){
			holder=new ViewHolder();
			convertView=inflater.inflate(R.layout.comment_item, null);
			holder.contentview=(TextView) convertView.findViewById(R.id.head_comment);
			holder.headImage=(ImageView) convertView.findViewById(R.id.head);
			convertView.setTag(holder);
		}else{
			holder=(ViewHolder) convertView.getTag();
		}
		holder.contentview.setText(list.get(position));
		return convertView;
	}
  class ViewHolder{
	  private TextView contentview;
	  private ImageView headImage;
  }
}
